jQuery.noConflict();
function checkSelect1(val,obj, o) {
	var item;
	if(val==1)
		item = document.getElementsByName('two_menu_id' + o);
	if(val==2)
		item = document.getElementsByName('three_menu_id' + o);
	if (obj.checked == true) {
		for ( var i = 0; i < item.length; i++) {
			item[i].checked = true;
		}
	} else {
		for ( var i = 0; i < item.length; i++) {
			item[i].checked = false;
		}
	}
}
function checkSelect2(obj, o) {
	var item = document.getElementById('one_menu_id' + o);
	if (obj.checked == true) {
		item.checked = true;

	}
	var item2 = document.getElementsByName(obj.name);
	var tag = true;
	for ( var i = 0; i < item2.length; i++) {
		if (item2[i].checked) {
			tag = false;
		}
	}
	if (tag) {
		item.checked = false;
	}
}
// 遍历获取所有CHECKED的值
function tijao() {

	Ti_rightinfoInfo.ifSame_CustClass(document.getElementById('cust_class').value, function(data) { // 不存在相同的角色

		if (data == 0) {

			document.getElementById('bpm_id').value = '2128'; //有则修改

		} else {

			document.getElementById('bpm_id').value = '7647'; //无则新增
		}

		// 不存在同名权限，执行提交程序
				var ckvalue = '';
				var item = document.getElementsByName('one_menu_id');

				for ( var i = 0; i < item.length; i++) {
					if (item[i].checked) {
						ckvalue = item[i].value + '|' + ckvalue;
						var h = item[i].getAttribute("tagI");
						var item2 = document.getElementsByName('two_menu_id' + h);
						for ( var j = 0; j < item2.length; j++) {
							if (item2[j].checked) {
								ckvalue = item2[j].value + '|' + ckvalue;
								var h2 = item2[j].getAttribute("tagI");
								var item3 = document.getElementsByName('three_menu_id' + h2);
								for ( var k = 0; k < item3.length; k++) {
									if (item3[k].checked) {
										ckvalue = item3[k].value + '|' + ckvalue;
									}
								}
							}
						}
					}
				}

				document.getElementById('menu_id').value = ckvalue;
				if (ckvalue == '') {
					alert('请选择权限菜单');
					return false;
				}
				//return false;
				document.addForm.submit();


	});


}




function right(){
	jQuery.ajax({
		url: "rightajax.jsp",
		type:"post",
		dataType:"html",
		cache:false,
		async:false,
		data: "cust_class='+document.getElementById('cust_class').value'",
		success:function(msg){
		  jQuery('#menu').html(msg);
		  jQuery('#menu').find('dd').hide().end().find('dt').click(function() {
				 var answer = jQuery(this).next();
				 if (answer.is(':visible')) {
					 answer.slideUp("fast");
				 } else {
					 answer.slideDown("fast");
				 }
				});
		  jQuery('input').each(function(){
				if(document.getElementById('checked_menu_id').value.indexOf(this.value) != -1){
					this.checked = true;
				}
			})
		 }
	});

}
function hasdown(){alert('该角色下有管理员，不允许删除！');}

function delIndexInfos(){
	var listsize = document.getElementById('listsize').value;
	var pkid_string = '';
	for(var i=0;i<listsize;i++){
		if(document.getElementById('checkone'+i).checked){
		    var flag = document.getElementById('hasDown'+i).value;
				if(flag == 1){
					alert('选中的角色下有管理员，不允许删除！');
					return false;
        }
				pkid_string += document.getElementById('checkone'+i).value+'|';
		}
	}
	if(pkid_string == ''){
		alert('请至少选择一条!');
		return false;
	}
	document.getElementById('pkid').value = pkid_string;
	document.indexForm.action='/doTradeReg.do';
	if(window.confirm('确认删除吗?')){
		document.indexForm.submit();
	}
}

function delOneNews(val){

  if(window.confirm('确认删除吗？'))
  {
 	  window.location.href='/doTradeReg.do?pkid='+val+'&bpm_id=9283';
  }

}
 function search(){

		document.indexForm.submit();
	 }